home *** CD-ROM | disk | FTP | other *** search
- rem Required Includes for use with MSSETUP DLL's
- rem -------------------------------------------------
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- rem Dialog box id's
- rem ---------------
- CONST DESTPATH = 300 ''Gets destination path
- CONST EXITQUIT = 600 ''Exits on user request
- CONST EXITSUCCESS = 700 ''Exits when install is done
- CONST ASKSETUP = 800 ''Gets setup options
- CONST REBOOTWARN = 900 ''Warn User of impending restart
- CONST REGMSG = 950 ''Reminder to user to register Product
- CONST QTWLAUNCH = 1000 ''Tell User how to Launch QTW 2.0 Setup
- CONST QTWWARN = 1100 ''Allow user to setup QTW 2.0
- CONST TOOBIG = 6300 ''Not enough space on target disk error
- CONST BADPATH = 6400 ''Bad destination path error
- CONST BADWINDOWS = 6500 ''Wrong Windows release
- CONST BADCOLORS = 6550 ''Not in 256 colors
- CONST EXITFAILURE = 6600 ''Exits on error
-
-
- rem String id's
- rem -----------
- CONST STR_UTILITY = 1024 ''Utility
- CONST STR_GROUP = 1025 ''Program Manager group
- CONST STR_TITLE = 1026 ''Installer Title
- CONST STR_MSG1 = 1027 ''Version error message part 1
- CONST STR_MSG2 = 1028 ''Version error message part 2
- CONST STR_WARNING = 1029 ''Warning
- CONST STR_SIREADME = 1030 ''SI Read Me
- CONST STR_PROGRAM = 1031 ''SI Almanac program
-
-
- rem Miscellaneous Constants
- rem -----------------------
- CONST NOLOGO = 1 ''Dummy NULL bitmap (must be 1)
- CONST LOGO = 2 ''Background bitmap
- CONST NOSPACE = 1 ''No space to complete install
- CONST INSTALLOK = 2 ''Install completed OK
- CONST INSTALLFAILED = 3 ''Install failed for some reason
- CONST UNINSTALLOK = 4 ''Uninstall completed OK
-
-
- rem Global Variables
- rem ----------------
- GLOBAL SOURCE$ ''Source directory
- GLOBAL DEST$ ''Default destination directory
- GLOBAL MYSYSDIR$ ''Windows/System directory
- GLOBAL MYWINDIR$ ''Windows directory
- GLOBAL SETUPTYPE$ ''Setup type (Local, Client, Server)
- GLOBAL MINIMUMINST$ ''Setup type (Local, Client, Server)
- GLOBAL PARTIALINST$ ''Setup type (Local, Client, Server)
- GLOBAL OPTIMUMINST$ ''Setup type (Local, Client, Server)
- GLOBAL QTWDIR$ ''QTW directory
- GLOBAL CUIDLL$ ''User interface DLL
- GLOBAL SETUPPATH$ ''Setup destination path
- GLOBAL HELPPROC$ ''Help dialog procedure
- GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
- GLOBAL APPNEEDS$ ''Disk space costs per drive
- GLOBAL SECTIONKEY$ ''INF file section key
- GLOBAL SUCCESS% ''Installation completion code
-
-
- rem Initialize global vriables
- rem --------------------------
- MINIMUMINST$ = "MIN"
- OPTIMUMINST$ = "OPT"
- SETUPTYPE$ = MINIMUMINST$
- SETUPPATH$ = "C:\FRANK"
- SOURCE$ = GetSymbolValue("STF_SRCDIR")
- DEST$ = SETUPPATH$
- SUCCESS% = INSTALLFAILED
- EXTRACOSTS$ = "ExtraCosts"
- APPNEEDS$ = "AppNeeds"
- SECTIONKEY$ = "SectionKey"
-
- FOR i% = 1 TO 26 STEP 1
- AddListItem EXTRACOSTS$, "16384"
- NEXT i%
-
-
- rem Get name of localized user interface dialogs
- rem --------------------------------------------
- CUIDLL$ = "setup.DLL"
-
-
- rem Subroutines and Functions
- rem -------------------------
- DECLARE FUNCTION Install (Level$) AS INTEGER
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
- DECLARE FUNCTION GetDLLVersion LIB "setup.dll" (szDLL$) AS INTEGER
- DECLARE FUNCTION HideCriticalDirectory LIB "setup.dll" (szDir$) AS INTEGER
- DECLARE FUNCTION Has256Colors LIB "setup.dll" (hinst%) AS INTEGER
- DECLARE FUNCTION GetResourceString LIB "setup.dll" (szResource$, idString%) AS INTEGER
- DECLARE FUNCTION StartCustomSetup LIB "setup.dll" (hinst%, hwnd%) AS INTEGER
- DECLARE FUNCTION StopCustomSetup LIB "setup.dll" (hinst%, hwnd%) AS INTEGER
- DECLARE FUNCTION SendMessage LIB "USER.EXE" (hWnd%, Message%, wParam%, lParam&) AS LONG
- DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
-
- rem Initialize custom setup logic
- rem -----------------------------
- rem SetBitmap CUIDLL$, NOLOGO
- i% = GetResourceString (CUIDLL$, STR_TITLE)
- SetTitle GetSymbolValue ("ResourceString")
- i% = StartCustomSetup (HinstFrame(), HwndFrame ())
- i% = SetBeepingMode(1)
-
-
- rem Make sure that we are running on Windows 3.1 or better
- rem ------------------------------------------------------
- IF GetWindowsMajorVersion() < 3 THEN
- sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
- UIPop 1
- GOTO CLEANUP
- END IF
-
- IF (GetWindowsMajorVersion() = 3) AND (GetWindowsMinorVersion() < 10) THEN
- sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
- UIPop 1
- GOTO CLEANUP
- END IF
-
-
- rem Make sure that we are running on a 386 or better
- rem ------------------------------------------------
- IF GetWinFlags() AND 2 THEN
- sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
- UIPop 1
- GOTO CLEANUP
- END IF
-
- rem Determine if QTW 2.0 is installed
- rem ---------------------------------
- exist%=0
- exist%=DoesFileExist(MYSYSDIR$+"QTNOTIFY.EXE",femExists)
- version$="0"
- IF exist% then
- version$=GetVersionOfFile(MYSYSDIR$+"QTNOTIFY.EXE")
- END IF
-
- IF exist%=0 then
- sz$=UIStartDlg(CUIDLL$,QTWWARN,"FRadioDlgProc",0,"")
- else
- if mid$(version$,1,1) <> "2" then
- sz$=UIStartDlg(CUIDLL$,QTWWARN,"FRadioDlgProc",0,"")
- end if
- end if
-
- if sz$="EXIT" then
- UIPop 1
- sz$=UIStartDlg(CUIDLL$,QTWLAUNCH,"FRadioDlgProc",0,"")
- GOTO CLEANUP
- else
- UIPop 1
- END IF
-
-
- rem Find and read the .INF file
- rem ---------------------------
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
-
- IF szInf$ = "" THEN
- szTemp$ = GetSymbolValue("STF_SRCDIR")
- szInf$ = szTemp$ + "FRANK.INF"
- END IF
-
- ReadInfFile szInf$
-
-
- rem Estimate the cost of the install
- rem --------------------------------
- ListSym$ = APPNEEDS$
- drive$ = MID$("C:\", 1, 1)
- ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
- AddSectionFilesToCopyList "Frankenstein", SOURCE$, "C:\"
- ClearCopyList
-
- rem Get the setup type
- rem ----------------------------------------
- ITYPE:
- rem SetSymbolValue "RadioDefault", SETUPTYPE$
-
- ITYPEL1:
- sz$ = UIStartDlg(CUIDLL$, ASKSETUP, "FRadioDlgProc", 0, "")
-
- rem SETUPTYPE$ = GetSymbolValue("ButtonChecked")
-
- IF sz$ = "CONTINUE" THEN
- SETUPTYPE$=OPTIMUMINST$
- UIPop 1
-
- ELSEIF sz$ = "CANCEL" THEN
- SETUPTYPE$=MINIMALINST$
- UIPop 1
-
- ELSE
- GOSUB ASKQUIT
- GOTO ITYPE
-
- END IF
-
- if SETUPTYPE$=MINIMALINST$ then
- GOTO INSTALL
- END IF
-
- rem Get the destination path; if it's bad, display an error
- rem ----------------------------------------------------------------
- GETPATH:
- SetSymbolValue "EditTextIn", DEST$
- SetSymbolValue "EditFocus", "END"
-
- GETPATHL1:
- sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", 0, "")
-
- DEST$ = GetSymbolValue("EditTextOut")
-
- IF sz$ = "CONTINUE" THEN
- IF IsDirWritable(DEST$) = 0 THEN
- GOSUB BADPATH
- GOTO GETPATHL1
- END IF
-
- UIPop 1
-
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO GETPATHL1
-
- ELSE
- GOSUB ASKQUIT
- GOTO GETPATH
-
- END IF
-
- rem Perform actual installation
- rem ---------------------------
- INSTALL:
- SUCCESS% = Install(SETUPTYPE$)
-
- IF SUCCESS% = NOSPACE THEN
- GOSUB TOOBIG
- GOTO GETPATH
- END IF
-
- rem De-installation completed
- rem -------------------------
- UNINSTALLED:
-
- rem When done, issue dialog
- rem -----------------------
- QUIT:
- IF SUCCESS% = INSTALLOK THEN
- rem Remind User about Registering Product
- sz$ = UIStartDlg(CUIDLL$, REGMSG, "FInfo0DlgProc", 0, "")
- UIPop 1
-
- rem Restart Windows
- 'sz$ = UIStartDlg(CUIDLL$, REBOOTWARN, "FInfo0DlgProc", 0, "")
- ' Check if any files were locked during install. If the RestartList
- ' is not empty, ExitExecRestart() will restart Windows, cleanup setup
- ' files, and copy over locked files before Windows restarts.
- i% = RestartListEmpty()
- IF i% = 0 THEN
- ' ExitExecRestart() only returns if applications refuse to be shutdown.
- ' Win32s is installed but will not operate until Windows is restarted
- ' and the Win32s VxD is loaded.
- ' i% = ExitExecRestart()
- ELSE
- ' If the RestartList list is empty, it is necessary to restart windows
- ' directly. The MSSETUP program creates _MSRSTRT.EXE and _MSSETUP.BAT
- ' in the restart directory. This program should be exec'd to handle
- ' proper MSSETUP cleanup (temp files) and restart Windows.
- ' i% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
- ENDIF
-
- ELSEIF SUCCESS% = UNINSTALLOK THEN
- sz$ = UIStartDlg(CUIDLL$, EXITDEINSTOK, "FInfo0DlgProc", 0, "")
- ELSE
- sz$ = UIStartDlg(CUIDLL$, EXITFAILURE, "FInfo0DlgProc", 0, "")
- END IF
- UIPop 1
-
- rem Clean up all processing
- rem -----------------------
- CLEANUP:
- i% = StopCustomSetup (HinstFrame(), HwndFrame ())
- END
-
-
- rem ASKQUIT: The user requested quit; does (s)he really want to?
- rem ------------------------------------------------------------
- ASKQUIT:
- sz$ = UIStartDlg(CUIDLL$, EXITQUIT, "FInfoDlgProc", 0, "")
- UIPop 1
- IF sz$ = "CONTINUE" THEN
- RETURN
- END IF
- GOTO CLEANUP
-
-
- rem BADPATH: The user entered an invalid destination directory
- rem ----------------------------------------------------------
- BADPATH:
- sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO BADPATH
- END IF
- UIPop 1
-
- RETURN
-
-
- rem TOOBIG: The source files won't fit on the requested destination disk
- rem --------------------------------------------------------------------
- TOOBIG:
- sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO TOOBIG
- END IF
- UIPop 1
-
- RETURN
-
- rem Install: Perform actual installation
- rem ------------------------------------
- FUNCTION Install (Level$) STATIC AS INTEGER
-
- rem Create the destination directory
- rem --------------------------------
- IF Level$=OPTIMUMINST$ then
- CreateDir DEST$, cmoNone
- END IF
-
- rem Determine the Windows\System directory
- rem --------------------------------------
- MYSYSDIR$ = GetWindowsSysDir
-
- rem Build the copy list
- rem -------------------
- if Level$=OPTIMUMINST$ then
- AddSectionFilesToCopyList "Frankenstein", SOURCE$, DEST$
- END IF
-
- rem Check that we have enough free space to perform the install
- rem -----------------------------------------------------------
- ListSym$ = APPNEEDS$
- StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
-
- drive$ = MID$(DEST$, 1, 1)
- ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
- cost& = VAL(GetListItem(APPNEEDS$, ndrive%))
- free& = GetFreeSpaceForDrive(drive$)
-
- IF cost& >= free& THEN
- Install = NOSPACE
- EXIT FUNCTION
- END IF
-
- rem Copy all the files from the source to the destination
- rem -----------------------------------------------------
- CopyFilesInCopyList
-
- rem Create a Program Manager group and appropriate items
- rem ----------------------------------------------------
- i% = GetResourceString (CUIDLL$, STR_GROUP)
- GROUP$ = GetSymbolValue ("ResourceString")
- CreateProgmanGroup GROUP$, "", cmoNone
-
- i% = GetResourceString (CUIDLL$, STR_PROGRAM)
- IF Level$=OPTIMUMINST$ then
- CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(DEST$,"FRANK.exe"), "", cmoOverwrite
- else
- CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(SOURCE$,"frank.exe"), "", cmoOverwrite
- END IF
- i% = GetResourceString (CUIDLL$, STR_SIREADME)
- CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(SOURCE$,"readme.txt"), "", cmoOverwrite
-
- CreateProgmanItem GROUP$, "Mary Shelley's Frankenstein 1818", MakePath(SOURCE$,"1818.WRI"), "", cmoOverwrite
- CreateProgmanItem GROUP$, "Mary Shelley's Frankenstein 1831", MakePath(SOURCE$,"1831.WRI"), "", cmoOverwrite
-
- CreateProgmanItem GROUP$, "Quicktime for Windows 2.0 Installer", MakePath(SOURCE$,"QTW20\setup.exe"), "", cmoOverwrite
-
- rem Save Paths when program installed to HD
- rem ---------------------------------------
-
- rem Check for \ at end of path
- REM --------------------------
- if Level$=OPTIMUMINST$ then
- if mid$(SOURCE$,len(SOURCE$),1) <> "\" then
- SOURCE$=SOURCE$+"\"
- end if
- if mid$(DEST$,len(DEST$),1) <> "\" then
- DEST$=DEST$+"\"
- end if
- CreateIniKeyValue (DEST$ + "TBM.INI"), "DRIVES", "CDPATH", SOURCE$, cmoOverwrite
- END IF
-
- rem Indicate install completed OK
- rem -----------------------------
- Install = INSTALLOK
-
- END FUNCTION
-
- rem MakePath: Builds path from directory and file
- rem ---------------------------------------------
- FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
-
- IF szDir$ = "" THEN
- MakePath = szFile$
-
- ELSEIF szFile$ = "" THEN
- MakePath = szDir$
-
- ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
- MakePath = szDir$ + szFile$
-
- ELSE
- MakePath = szDir$ + "\" + szFile$
-
- END IF
-
- END FUNCTION
-
-